﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _07_Enum
{
    public enum QQState
    {
        OffLine,
        OnLine,
        Leave,
        Busy,
        Me
    }

    class Program
    {
        static void Main(string[] args)
        {
 
            QQState state = QQState.Busy;

            #region int 转 枚举
            //int a = 2;
            //state = (QQState)a;
            //Console.WriteLine(state);
            #endregion

            #region 枚举 转 int
            //int a = 10;
            //a = (int)state;
            //Console.WriteLine(a);
            #endregion

            #region 枚举 转 string
            //string s = state.ToString();
            //Console.WriteLine(s);
            #endregion

            #region string 转 枚举
            //string str = "Busy";
            //state = (QQState)Enum.Parse(typeof(QQState),str); //可能会抛出异常
            //Console.WriteLine(state);
            #endregion


            Console.ReadKey();
        }
    }
}
